/*
 * Course:        COMP 380
 * Semester:      Summer 2012
 * Assignment:    Text To Speech
 * File Name:     importwindow.java
 * Author:        James Paul Pan
 * 				  Kenneth Wakeland
 * 				  Peter Xaymountry
 * Group #:		  Group #3
 */

package com.comp380.texttospeech;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

/*
 * This class purpose is to redirect the user to their SMS messaging screen 
 * or email screen so they can copy text and paste it to this program for it to speak.
 */
public class importwindow extends Activity implements OnClickListener 
{
	// Initialize the buttons variables.
	Button btnClearSaved, btnDone, btnNavMain, 
		   btnNavSaved, btnNavShare, btnNavImport;
	
	// Initialize the ImageView button variables.
	ImageView sms, email;

	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		
		//Keep the screen orientation in portrait mode
    	super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    	
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		// Set the layout for this activity.
		setContentView(R.layout.importwindow);

		// Pass the variables to correspond with the Main button.
		btnNavMain = (Button) findViewById(R.id.btnNavMain);
		
		// When the button is click it goes to the onClick method and take
		// the user to the Main screen.
		btnNavMain.setOnClickListener(this);
		
		// Pass the variables to correspond with the Saved button.
		btnNavSaved = (Button) findViewById(R.id.btnNavSaved);
		
		// When the button is click it goes to the onClick method and take
		// the user to the Saved screen.
		btnNavSaved.setOnClickListener(this);
		
		// Pass the variables to correspond with the Share button.
		btnNavShare = (Button) findViewById(R.id.btnNavShare);
		
		// When the button is click it goes to the onClick method and take
		// the user to the Share screen.
		btnNavShare.setOnClickListener(this);
		
		// Pass the variables to correspond with the Import button.
		btnNavImport = (Button) findViewById(R.id.btnNavImport);
		
		// When the button is click it goes to the onClick method and take
		// the user to the Import screen.
		btnNavImport.setOnClickListener(this);
		
		// Pass the variables to correspond with the SMS image button.
		sms = (ImageView) findViewById(R.id.sms);
		
		// When the button is click it goes to the onClick method and take
		// the user to the SMS Messaging screen.
		sms.setOnClickListener(this);
		
		// Pass the variables to correspond with the Email image button.
		email = (ImageView) findViewById(R.id.email);
		
		// When the button is click it goes to the onClick method and take
		// the select which Email application they want to use.
		email.setOnClickListener(this);

	}
	
	/*
	 * This method will handle what happen when the user click on a particular 
	 * button.
	 */
	public void onClick(View v) 
	{
		if (v.getId() == R.id.btnNavSaved)
		{
			// Display a message that the user click on the Saved button.
			Toast.makeText(getBaseContext(), "Going to the Saved screen", Toast.LENGTH_SHORT).show();
			
			// This will start the transition to the Saved screen.
			startActivity(new Intent(this, SavedAudio.class));
		}
		
		else if (v.getId() == R.id.btnNavMain)
		{
			// Display a message that the user click on the Main button.
			Toast.makeText(getBaseContext(), "Going to the Main screen", Toast.LENGTH_SHORT).show();
			
			// This will start the transition to the Main screen.
			startActivity(new Intent(this, Text_to_speechActivity.class));
		}
		
		else if (v.getId() == R.id.btnNavShare)
		{
			
			// Display a message that the user click on the Share button.
			Toast.makeText(getBaseContext(), "Going to the Share screen", Toast.LENGTH_SHORT).show();
						
			// This will start the transition to the Share screen.
			startActivity(new Intent(this, share.class));
		}
		
		else if (v.getId() == R.id.btnNavImport)
		{
			// Display a message that tell the user, they are already in the import screen.
			Toast.makeText(getBaseContext(), "Your already in the Import screen", Toast.LENGTH_SHORT).show();
		}

		else if (v.getId() == R.id.sms) 
		{
			// Display a message that the user click on the SMS button.
			Toast.makeText(getBaseContext(), "Going to the SMS screen", Toast.LENGTH_SHORT).show();
						
			Intent sms = new Intent(Intent.ACTION_MAIN);
			sms.addCategory(Intent.CATEGORY_LAUNCHER);
			sms.setClassName("com.android.mms",
					"com.android.mms.ui.ConversationList");
			
			// This will start the transition to their SMS screen.
			startActivity(sms);
		}

		else if (v.getId() == R.id.email) 
		{
			// Display a message that the user click on the Email button.
			Toast.makeText(getBaseContext(), "Going to the Email select screen", Toast.LENGTH_SHORT).show();
			
			// This variable will store the function that will 
			// take the user to the Email screen.
			Intent intent = new Intent(getBaseContext(), Email.class);
			
			// This will start the transition to select Email screen.
			startActivity(intent);
		}
	}
}
